from django.shortcuts import get_object_or_404
from django.forms import ModelForm
from django.views.decorators.cache import cache_page

from brispon.util import BaseSearchForm, paginate, inc_paginate
from brispon.util.decorators import render, render_to, ajax_request
from brispon.models import Category


#@cache_page(60 * 60)
@render_to('d/category/list.html')
def list(request):
    categories = Category.objects.all()
    return {'categories':categories}

@render_to('d/category/store.html')
def detail(request, category_id):
    category = Category.objects.get(pk=category_id)
    stores = category.store_set.all()
    return {'stores':stores}

        
@render_to('m/category/list.html')
def mlist(request):
    return get_objects_page_context(Store.objects.all(), request.GET,)
            #search_form=AnalysisResultSearchForm(request.GET or None))
